<%@ include file="/WEB-INF/jsp/includes.jsp" %>
<%@ include file="/WEB-INF/jsp/header.jsp" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<h2><fmt:message key="album.information"/></h2>

  <table>
    <tr>
      <th><fmt:message key="album.name"/></th>
      <td><b>${album.name}</b></td>
    </tr>
    <tr>
      <th><fmt:message key="album.creation.date"/></th>
        <%--<fmt:formatDate value="${album.creationDate}" pattern="yyyy-MM-dd"/>--%>
      <td>${album.creationDate}</td>
    </tr>
    <tr>
      <th><fmt:message key="album.modify.date"/></th>
      <td>${album.modifyDate}</td>
    </tr>
    <tr>
      <th><fmt:message key="album.publish.date"/></th>
      <td>${album.publishDate}</td>
    </tr>
    <tr>
      <th><fmt:message key="album.public"/></th>
      <td>${album.isPublic}</td>
    </tr>
  </table>
  <table class="table-buttons">
    <tr>
      <td colspan="2" align="center">
        <spring:url value="{albumId}/edit" var="editUrl">
        	<spring:param name="albumId" value="${album.id}" />
        </spring:url>
        <a href="${fn:escapeXml(editUrl)}"><fmt:message key="album.button.edit"/></a>
      </td>
      <td>
        <spring:url value="{albumId}/images/new" var="addUrl">
        	<spring:param name="albumId" value="${album.id}" />
        </spring:url>
        <a href="${fn:escapeXml(addUrl)}"><fmt:message key="image.button.new"/></a>
      </td>
    </tr>
  </table>

  <h2>Images</h2>

  <c:forEach var="image" items="${album.images}">
    <table width="94%">
      <tr>
        <td valign="top">
          <table>
            <tr>
              <th><fmt:message key="image.name"/></th>
              <td><b>${image.name}</b></td>
            </tr>
            <tr>
              <th><fmt:message key="image.image"/></th>
                <spring:url value="/albums/images/{imageId}" var="imageLink">
        	<spring:param name="imageId" value="${image.id}" />
        </spring:url>
              <td><img src="${fn:escapeXml(imageLink)}" alt="image"/></td>
            </tr><%--
            <tr>
              <th>Thumb</th>
              <td><img src="/thumb.jpg?id=${image.id}" alt="thumb"/></td>
            </tr>--%>
          </table>
        </td>
      </tr>
    </table>
    <table class="table-buttons">
      <tr>
        <td>
          <spring:url value="{albumId}/images/{imageId}/edit" var="imageUrl">
            <spring:param name="albumId" value="${album.id}"/>
            <spring:param name="imageId" value="${image.id}"/>
          </spring:url>
          <a href="${fn:escapeXml(imageUrl)}"><fmt:message key="image.button.edit"/></a>
        </td>
      </tr>
    </table>
  </c:forEach>
  
<%@ include file="/WEB-INF/jsp/footer.jsp" %>
